package com.hyq.learn.web.listenen;

import com.hyq.learn.common.util.HostNameUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;

/**
 * @author heyuqin
 * @date 2024/5/27 17:56
 */
public class ApplicationCloseListener implements ApplicationListener<ContextClosedEvent> {

    private final static Logger LOGGER = LoggerFactory.getLogger(ApplicationStartListener.class);

    @Override
    public void onApplicationEvent(ContextClosedEvent event) {
        String hostName = HostNameUtil.localHostName();
        LOGGER.info("service closed, name:{}", hostName);
    }
}
